package com.example.erp.controller.permission;

import com.example.erp.dto.permissionDTO.RoleDTO;
import com.example.erp.pojo.permission.Role;
import com.example.erp.service.permission.RoleService;
import com.example.erp.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/admin/permission/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @GetMapping("/list")
    private Result list(RoleDTO roleDTO) {
        return roleService.list(roleDTO);
    }

    @GetMapping("/listAll")
    private Result listAll() {
        return roleService.listAll();
    }

    @PostMapping("/add")
    private Result add(@RequestBody Role role) {
        return roleService.add(role);
    }

    @PostMapping("/edit")
    private Result edit(@RequestBody Role role) {
        return roleService.edit(role);
    }

    @DeleteMapping("/remove")
    private Result remove(@RequestBody List<Long> ids) {
        return roleService.remove(ids);
    }
}
